import os
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory


def generate_launch_description():

    '''
        配置文件声明
    '''
    rtk_config = os.path.join(
        get_package_share_directory('rtk_fast30'),
        'config',  # 配置文件所在目录
        'config.yaml'
    )
    rviz_config = os.path.join(
        get_package_share_directory('rtk_fast30'),
        'config',
        'rtk_view.rviz'
    )
    
    rtk_fast30 = Node(
        package='rtk_fast30',  
        executable='rtk_fast30',     
        name='rtk_fast30',    
        output='screen',           
        parameters=[rtk_config]
    )
    rviz=Node(
            package='rviz2',
            executable='rviz2',
            name='rviz2',
            arguments=['-d', rviz_config],
            output='screen'
        )
   
    return LaunchDescription([
        rtk_fast30,
        rviz
    ])